package com.liyu.iblog.utils;

import java.util.List;

import org.mcavallo.opencloud.Cloud;

import com.liyu.iblog.domain.Tag;

public class TagCloudUtils {
    
    public static Cloud generateTagCloud(List<Tag> tags) {
        Cloud cloud = new Cloud();
        cloud.setMaxWeight(38);
        for (Tag t : tags) {
            org.mcavallo.opencloud.Tag cTag = new org.mcavallo.opencloud.Tag();
            cTag.setName(t.getName());
            cTag.setLink("/blogs/tag/" + t.getId());
            cTag.setScore(t.getBlogKeys().size());
            cloud.addTag(cTag);
        }
        return cloud;
    }
}
